package engine.display
{
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.events.EventDispatcher;

	public class Optimize extends EventDispatcher
	{
		public function Optimize()
		{
			
		}
		
		/**
		 * 递归停止动画播放 
		 * @param mc
		 * 
		 */		
		public static function stopMovieClip(mc:DisplayObject):void
		{	
			if(mc == null)
			{
				return;
			}
			
			if(!mc.hasOwnProperty("numChildren"))
			{
				return;
			}
			
			var tSize:uint	=	mc["numChildren"];
			
			if(tSize == 0)
			{
				return;
			}
			
			for(var i:int = 0 ; i < tSize ; i ++)
			{
				stopMovieClip(mc["getChildAt"](i));
				//trace(getQualifiedClassName(mc["getChildAt"](i)));
				if((mc["getChildAt"](i) as MovieClip) != null)
				{
					(mc["getChildAt"](i) as MovieClip).stop();
				}
			}			
		}
	}
}